struct nrCarrierConfig
    NCELLID::Float64
    NSizeGrid::Float64
    NStartGrid::Float64
    NSlot::Float64
    NFrame::Float64
    IntraCellGuardBands::Matrix{Float64}
    SymbolsPerSlot::Float64
    SlotsPerSubframe::Float64
    SlotsPerFrame::Float64
    SubcarrierSpacing::Float64
    CyclicPrefix::String
end

# 创建nrCarrierConfig实例并赋初值
carrier = nrCarrierConfig(
    1,
    51,
    0,
    199,
    0,
    zeros(Float64, 0, 2),
    14,
    2,
    20,
    30,
    "normal"
)

function hSubbandChannelEstimate(carrier,rxGrid,refInd,refSym,bundleSize,varargin)

    # Dimensionality information for subband channel estimation
    K = carrier.NSizeGrid * 12;
    L = carrier.SymbolsPerSlot;
    R = size(rxGrid,3);
    P = size(refInd,2);
    # Get subcarrier indices 'k' used by the DM-RS, corresponding
    # PRG indices 'prg', and set of unique PRGs 'uprg'
    k = map(x -> Tuple(CartesianIndices((K, L))[x])[1], refInd)
    prg,uprg,prgInfo = hPRGIndices(carrier,bundleSize,k(:,1))
    # Perform channel estimation for each PRG
    Hest = zeros(K, L, R, P)
    nVarPRGs = zeros(prgInfo.NPRG)
    for i = 1:length(uprg)
        HPRG, nVarPRGs[uprg[i]] = nrChannelEstimate(rxGrid, refInd[prg.== uprg[i], :], refSym[prg.== uprg[i], :], varargs...)
        Hest = Hest + HPRG;
    end
    noiseEst = nVarPRGs[uprg];
    return  Hest, noiseEst 
    end
  
    function hPRGIndices(carrier,bundleSize,k)
    # Calculate PRG indices 'prg', and set of unique PRGs 'uprg' for subcarrier
    # indices 'k'
    
    prgInfo = nrPRGInfo(carrier,bundleSize)
    rb = floor.(Int, (k .- 1) / 12)
    prg = prgInfo.PRGSet[rb .+ 1]
    uprg = unique(prg)
    return prg,uprg,prgInfo
    end
    